<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Cat(name, color) {
    // 添加属性
    this.name = name;
    this.color= color;
  }
  // 在构造函数原型上添加方法
  Cat.prototype.sayHi = function() {
    console.log('Hi,我是'+this.name);
  }
  // 创建实例对象
  var miao=new Cat('小猫','白色');
  
    </script>
</body>
</html>